package config

import (
	"os"

	"gopkg.in/yaml.v3"
)

type ProxyConfig struct {
	KubeConfigFile string `yaml:"kubeConfigFile"`
	ListenAddr     string `yaml:"listenAddr"`
	LinkSaasAddr   string `yaml:"linkSaasAddr"` //linksaas api服务地址
}

func LoadProxyConfig(fileName string) (*ProxyConfig, error) {
	data, err := os.ReadFile(fileName)
	if err != nil {
		return nil, err
	}
	cfg := &ProxyConfig{}
	err = yaml.Unmarshal(data, cfg)
	if err != nil {
		return nil, err
	}
	return cfg, nil
}
